'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH PAM_SMBFS_LOGIN 7 "August 19, 2023"
.SH NAME
pam_smbfs_login \- PAM user credential authentication module for SMB/CIFS
client login
.SH SYNOPSIS
.nf
pam_smb_cred.so.1
.fi

.SH DESCRIPTION
The \fBpam_smbfs_login\fR module  implements \fBpam_sm_setcred\fR(3PAM) to
provide functions that act equivalently to the \fBsmbutil\fR(1) login command.
.sp
.LP
This optional functionality is meant  to be used only in environments  that  do
not run Active Directory or Kerberos, but which synchronize passwords between
clients and their CIFS/SMB servers.
.sp
.LP
This module permits the login password to be stored as if the \fBsmbutil\fR(1)
login command was used to store a password for PAM_USER in the user or system
default  domain. The choice of default domain is the first of the following:
.br
.in +2
-Domain entry specified in the  default  section of the \fB$HOME/.nsmbrc\fR
file, if readable.
.in -2
.br
.in +2
-Domain entry specified in the default section shown by the sharectl get smbfs
command.
.in -2
.br
.in +2
-String WORKGROUP.
.in -2
.sp
.LP
Because \fBpam_smbfs_login\fR runs as root during the login process, a
\fB$HOME/.nsmbrc\fR file accessed through NFS may only be readable if the file
permits reads by others. This conflicts with the requirement that passwords
stored in \fB$HOME/.nsmbrc\fR are ignored when permissions are open.
.sp
.LP
To use this functionality,  add the following line to the \fB/etc/pam.conf\fR
file:
.sp
.in +2
.nf
login  auth optional    pam_smbfs_login.so.1
.fi
.in -2

.sp
.LP
Authentication service modules must implement both
\fBpam_sm_authenticate\fR(3PAM) and \fBpam_sm_setcred\fR(3PAM). In this module,
\fBpam_sm_authenticate\fR(3PAM) always returns \fBPAM_IGNORE\fR.
.sp
.LP
The \fBpam_sm_setcred\fR(3PAM) function accepts the following flags:
.sp
.ne 2
.na
\fB\fBPAM_REFRESH_CRED\fR\fR
.ad
.sp .6
.RS 4n
Returns PAM_IGNORE.
.RE

.sp
.ne 2
.na
\fB\fBPAM_SILENT\fR\fR
.ad
.sp .6
.RS 4n
Suppresses messages.
.RE

.sp
.ne 2
.na
\fB\fBPAM_ESTABLISH_CRED\fR\fR
.ad
.br
.na
\fB\fBPAM_REINITIALIZE_CRED\fR\fR
.ad
.sp .6
.RS 4n
Stores the authentication token for PAM_USER in the same manner as the
\fBsmbutil\fR(1) login command.
.RE

.sp
.ne 2
.na
\fB\fBPAM_DELETE_CRED\fR\fR
.ad
.sp .6
.RS 4n
Deletes the stored password for PAM_USER in the same manner as the
\fBsmbutil\fR(1) logout command.
.RE

.sp
.LP
The following options can be passed to the \fBpam_smbfs_login\fR module:
.sp
.ne 2
.na
\fB\fBdebug\fR\fR
.ad
.sp .6
.RS 4n
Produces \fBsyslog\fR(3C) debugging information at the LOG_AUTH or LOG_DEBUG
level.
.RE

.sp
.ne 2
.na
\fB\fBnowarn\fR\fR
.ad
.sp .6
.RS 4n
Suppresses warning messages.
.RE

.SH FILES
.ne 2
.na
\fB\fB$HOME/.nsmbrc\fR\fR
.ad
.RS 28n
Find default domain, if present.
.RE

.SH ERRORS
Upon successful completion of \fBpam_sm_setcred\fR(3PAM), \fBPAM_SUCCESS\fR is
returned. The  following  error codes are returned upon error:
.sp
.ne 2
.na
\fB\fBPAM_USER_UNKNOWN\fR\fR
.ad
.sp .6
.RS 4n
User is unknown.
.RE

.sp
.ne 2
.na
\fB\fBPAM_AUTHTOK_ERR\fR\fR
.ad
.sp .6
.RS 4n
Password is bad.
.RE

.sp
.ne 2
.na
\fB\fBPAM_AUTH_ERR\fR\fR
.ad
.sp .6
.RS 4n
Domain is bad.
.RE

.sp
.ne 2
.na
\fB\fBPAM_SYSTEM_ERR\fR\fR
.ad
.sp .6
.RS 4n
System error.
.RE

.SH ATTRIBUTES
See \fBattributes\fR(7) for descriptions of the following attribute:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
_
MT Level	MT-Safe with exceptions
.TE

.SH SEE ALSO
.BR smbutil (1),
.BR syslog (3C),
.BR libpam (3LIB),
.BR pam (3PAM),
.BR pam_setcred (3PAM),
.BR pam_sm (3PAM),
.BR pam_sm_authenticate (3PAM),
.BR pam_sm_setcred (3PAM),
.BR smbfs (4FS),
.BR pam.conf (5),
.BR attributes (7)
.SH NOTES
The interfaces in \fBlibpam\fR(3LIB) are MT-Safe only if each thread within the
multi-threaded application uses its own PAM handle.
